<template>
    <div class="gallery iconfont">
        <div @click="galleryToggle">
            <slider :banners="ajaxData.data.gallery" :swiperOptions="swiperOptions" @change-index="changeIndex"></slider>
            <p><b>{{sliderIndex}}</b>/<span>{{ajaxData.data.gallery.length}}</span></p>
        </div>
    </div>
</template>

<script>
    import Slider from "./slider"
    export default {
        name: "gallery",
        components:{
            Slider
        },
        inject:['ajaxData'],
        data(){
            return{
                swiperOptions:{
                    loop:false,
                    autoplay:false,
                    notNextTick:false
                },
                sliderIndex:1
            }
        },
        methods:{
            changeIndex(index){
                this.sliderIndex=index
            },
            galleryToggle(){
                this.$emit('click')
            }
        }

    }
</script>

<style lang="scss" scoped>
    .gallery{
        >div{
            position:absolute;
            z-index: 12;
            top:0;
            bottom:0;
            left:0;
            right:0;
            background-color: #000;
            color:#fff;
            ::v-deep .slider{
                display: flex;
                align-items: center;
                height:100%;
            }
            >p{
                position: relative;
                text-align: center;
                bottom: 1rem;
            }
        }

    }

</style>
